<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<jsp:useBean id="user" class="entity.User" scope="session"/>
<jsp:useBean id="appointments" class="java.util.ArrayList" scope="request"/>
<html>
	<head>
		<title>Recreation Manager - Administracija mečeva</title>
		<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="theme.css">
		<script type="text/javascript" src="scripts/linkfader.js"></script>	
	</head>
	<c:if test="${user.type!='A'}">
		<c:redirect url="./login.jsp" />
	</c:if>
	<body>
	<center>
	<c:import url="./header.jsp"></c:import>
	<table class="mainTable">
		<tr>
			<td width="200px" valign="top">
				<c:import url="./menu.jsp"></c:import>
			</td>			
			<td valign="top">
			<!-- itt kezdodik -->
				<c:if test="${!empty appointments}">
				<table class="list">
					<thead>
						<tr>
							<th colspan="5"><h2>Administracija mečeva</h2></th>
						</tr>
						<tr>
							<th colspan="5">Termini</th>
						</tr>
						<tr>
							<th>Lokacija:</th>
							<th>Datum:</th>
							<th>Od:</th>
							<th>Do:</th>	
							<th>Administracija:</th>			
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${appointments}" var="app">
							<tr>
								<td>${app.location}</td>
								<td><fmt:formatDate value="${app.date}" pattern="dd.MM.yyyy" /> </td>
								<td><fmt:formatDate value="${app.from}" pattern="HH:mm"/></td>
								<td><fmt:formatDate value="${app.to}" pattern="HH:mm"/></td>
								<td><a href="./AdminMatch?appId=${app.appointmentId}">Administracija</a></td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
				</c:if>
				<c:if test="${empty appointments}">
					
					<table class="list">
						<thead>
							<tr>
								<th colspan="5"><h2>Administracija mečeva</h2></th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>&nbsp;</td>
							</tr>
							<tr>
								<td><h3>Trenutno nema termina koji bi trebao adminstrirati</h3></td>
							</tr>
						</tbody>
					</table>
				</c:if>
			<!-- itt vegzodik -->
			</td>
		</tr>
	</table>	
	

		
		
	</center>
	</body>	
</html>